import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/dashboard'
    },
    {
      path: '/dashboard',
      name: 'dashboard',
      components: require('@/components/DashboardPage'),
      children: [
        {
          path: '/',
          name: 'welcome',
          components: require('@/components/WelcomePage')
        },
        {
          path: 'immune',
          name: 'immune',
          components: require('@/components/Immune/ImmunePage')
        },
        {
          path: 'immune/add',
          name: 'immune_add',
          components: require('@/components/Immune/ImmuneAddPage')
        },
        {
          path: 'record',
          name: 'record',
          components: require('@/components/Record/RecordPage')
        },
        {
          path: 'record/add',
          name: 'record_add',
          components: require('@/components/Record/RecordAddPage')
        },
        {
          path: 'user',
          name: 'user',
          components: require('@/components/User/UserPage')
        },
        {
          path: 'user/add',
          name: 'user_add',
          components: require('@/components/User/UserAddPage')
        },
        {
          path: 'setting/category',
          name: 'setting_category',
          components: require('@/components/Setting/CategoryPage')
        },
        {
          path: 'setting/category/add',
          name: 'setting_category_add',
          components: require('@/components/Setting/CategoryAddPage')
        },
        {
          path: 'setting/backup',
          name: 'setting_backup',
          components: require('@/components/Setting/BackupPage')
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      components: require('@/components/LoginPage')
    },
    {
      path: '*',
      redirect: '/dashboard'
    }
  ]
})
